package org.homeunix.josivan.gwt.tool.gtic;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import com.google.gwt.core.ext.TreeLogger.Type;
import com.google.gwt.dev.CompilerOptions;
import com.google.gwt.dev.jjs.JsOutputOption;

class IncrementalCompilerOptions implements CompilerOptions {
  //private final File sourceDir;
  private final File outputDir;
  private List<String> modulesName = new ArrayList<String>();
  private JsOutputOption outputOption = JsOutputOption.OBFUSCATED;
  private Type logLevel = Type.ERROR;
  private int localWorkers = 1;
  private boolean aggressivelyOptimize = true;
  private File workDir = new File(System.getProperty("java.io.tmpdir"));
  
  IncrementalCompilerOptions(/*File source, */ File output) {
    //this.sourceDir = source;
    this.outputDir = output;
  }

  public boolean isAggressivelyOptimize() {
    return this.aggressivelyOptimize;
  }

  public void setAggressivelyOptimize(boolean aggressivelyOptimize) {
    this.aggressivelyOptimize = aggressivelyOptimize;
  }

  public boolean isEnableAssertions() {
    return false;
  }

  public void setEnableAssertions(boolean enableAssertions) {

  }

  public JsOutputOption getOutput() {
    return this.outputOption;
  }

  public void setOutput(JsOutputOption outputOption) {
    this.outputOption = outputOption;
  }

  public boolean isUseGuiLogger() {
    return false;
  }

  public void setUseGuiLogger(boolean useGuiLogger) {
  }

  public void addModuleName(String moduleName) {
    this.modulesName.clear(); // to compile a single module each time
    this.modulesName.add(moduleName);
  }

  public List<String> getModuleNames() {
    return this.modulesName;
  }

  public void setModuleNames(List<String> moduleNames) {
    this.modulesName = moduleNames;
  }

  public Type getLogLevel() {
    return this.logLevel;
  }

  public void setLogLevel(Type logLevel) {
    this.logLevel = logLevel;
  }

  public File getWorkDir() {
    return this.workDir;
  }

  public void setWorkDir(File dir) {
  }

  public File getGenDir() {
    return this.outputDir;
  }

  public void setGenDir(File dir) {
  }

  public boolean isValidateOnly() {
    return false;
  }

  public void setValidateOnly(boolean validateOnly) {
  }

  public boolean isUpdateCheckDisabled() {
    return false;
  }

  public void setDisableUpdateCheck(boolean disabled) {
  }

  public File getExtraDir() {
    return this.outputDir;
  }

  public void setExtraDir(File extraDir) {
  }

  public File getWarDir() {
    return this.outputDir;
  }

  public void setWarDir(File dir) {
    //this.outputDir = dir;
  }

  public int getLocalWorkers() {
    return this.localWorkers;
  }

  public void setLocalWorkers(int localWorkers) {
    this.localWorkers = localWorkers;
  }
}